package com.chapter01exercise.homework13;

/**
 * @Author 小闽
 * @Date 2024/8/21 10:08
 * @PackageName: com.chapter01exercise.homework13
 * @ClassName: Person
 * @Description: 人类
 * @Version 1.0
 */
public class Person {
    private String name;
    private char sex;
    private int age;

    /**
     * 构造器
     * @param name
     * @param sex
     * @param age
     */
    public Person(String name, char sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    /**
     * 定义父类的play()方法
     */
    public String play(){
        return getName();
    }
    /**
     * 定义getInfo()方法，用于打印个人信息
     */
    public String  getInfo(){
        return  "姓名：" + "\t" + getName() +  "\n" + "性别：" + "\t" + getSex() +  "\n" +  "年龄：" + "\t" + getAge();
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", sex=" + sex +
                ", age=" + age +
                '}';
    }
}
